<?php defined ( 'SUROBOT' ) or exit ( 'No direct script access allowed' );
/**
 * 图灵机器人接口功能操作静态类
 * @author WispX
 * @copyright WispX
 * @link http://www.xlogs.cn
 */

class TulingPer extends CommonPer {
	
	public static function SendMsg($str)
	{
		$tuling = self::getTulingConfig();
		$result = array();
		$result['code'] = 1;
		$data = array(
				'key' 	=> $tuling['api_key'],
				'info'	=> $str
		);
		$request = json_decode(Fun::Curl($tuling['api_url'], $data), true);
		$result['text'] = $request['text'];
		if(!$request) $result['text'] = "接口请求异常！如果您是管理员请检查配置是否正确！";
		if(!Fun::Equals(!empty($request['url']) ? $request['url'] : null, null)) {
			$result['text'] .= " " . Fun::GetUrlHtmlA($request['url']);
		}
		return json_encode($result);
	}
	
}

?>